Event.observe ( window, 'load', bootstrap );

function bootstrap () {
  $$( 'a.ci_log'             ).each ( function ( id ) { Event.observe ( id, 'click', display_ci_log     ) } );
  $$( 'a.pull_specification' ).each ( function ( id ) { Event.observe ( id, 'click', pull_specification ) } );
  $$( 'a.pull_integration'   ).each ( function ( id ) { Event.observe ( id, 'click', pull_integration   ) } );
}

function display_ci_log ( event ) {
  new Ajax.Request ( '/rest/job/' + this.id + '/column/main_log', {
    method         : 'get',
    requestHeaders : { Accept : 'application/json' },
    onComplete     : function ( transport ) {
      show_popup ( event, transport.responseJSON.column );
    }
  } );
}

function pull_specification () { pull ( this.id.replace ( /^specification-/, "" ), 'specification' ); }
function pull_integration   () { pull ( this.id.replace ( /^integration-/,   "" ), 'integration'   ); }
